package com.barbarosso.video.controller {
	import com.barbarosso.video.ApplicationFacade;	
	import com.barbarosso.video.VideoPlayer;
	import com.barbarosso.video.view.VideoControllerMediator;
	import com.barbarosso.video.view.VideoPlayerMediator;
	import com.barbarosso.video.view.VideoScreenMediator;
	import com.barbarosso.video.view.components.VideoController;
	import com.barbarosso.video.view.components.VideoScreen;
	
	import org.puremvc.as3.multicore.interfaces.INotification;
	import org.puremvc.as3.multicore.patterns.command.SimpleCommand;		

	/**
	 * @author barbarosso
	 */
	public class ViewPrepCommand extends SimpleCommand {
		override public function execute ( note:INotification ) : void {
			
			var videoPlayer : VideoPlayer = note.getBody() as VideoPlayer;
			var videoPlayerMediator : VideoPlayerMediator = new VideoPlayerMediator(VideoPlayerMediator.NAME, videoPlayer);
			facade.registerMediator(videoPlayerMediator);
			
			
			var videoScreen : VideoScreen = videoPlayer.videoScreen;
			var videoScreenMediator : VideoScreenMediator = new VideoScreenMediator(VideoScreenMediator.NAME , videoScreen);
			facade.registerMediator(videoScreenMediator);
			
			var videoController : VideoController = videoPlayer.videoController;
			var videoControllerMediator : VideoControllerMediator = new VideoControllerMediator(VideoControllerMediator.NAME , videoController);
			facade.registerMediator(videoControllerMediator);
			
			sendNotification(ApplicationFacade.PLAY_VIDEO);
		}
	}
}
